package com.hs.telepass.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.hs.teleform.R;
import com.hs.telepass.manager.PreferencesManager;

/**
 * Created by Lin on 2014/10/30.
 */
public class SplashActivity extends Activity {

    public static String INIT_USER = "init_user";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        //闪屏   2秒后进入主程序
        new Handler().postDelayed(new Runnable() {

            public void run() {
                Intent intent = new Intent();
//                boolean isInit = PreferencesManager.getInstance().isInitInstall();
                //初次安装应用进入闪屏界面
                if (false) {
                    intent.setClass(SplashActivity.this, WelcomeActivity.class);
                    intent.putExtra(INIT_USER,true);
                    PreferencesManager.getInstance().setInitInstall(false);
                } else {
                    intent.setClass(SplashActivity.this,
                            MainActivity.class);
                }
                startActivity(intent);
                finish();


                //实现淡入淡出的效果
                overridePendingTransition(android.R.anim.fade_in,
                        android.R.anim.fade_out);
            }
        }, 2000);

    }

}